/*
 *  Disc Catalog
 *  A little application to quickly catalog and find contents of your
 *  DVD archives.
 *
 *  File.h
 *  The class representing the leaf and the nodes in the model's tree.
 *
 *
 *  Created by Nicola Gigante on 18/12/08.
 *  Copyright (C) 2008  Nicola Gigante
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#import <Cocoa/Cocoa.h>


@interface File : NSObject
{
	NSMutableArray *files;
	NSMutableArray *visibleFiles;
	NSString *name;
	NSString *type;
	NSString *typeString;
	unsigned long long size;
	NSImage *icon;
	NSString *notes;
	File *root;
	
	BOOL isPackage;
	BOOL isHidden;
	
	BOOL showHiddenFiles;
}

@property (retain) NSMutableArray *files;
@property (retain) NSMutableArray *visibleFiles;
@property (retain) NSString *name;
@property (retain) NSString *type;
@property (retain) NSString *typeString;
@property		   unsigned long long size;
@property          BOOL isPackage;
@property          BOOL isHidden;
@property (retain) NSImage *icon;
@property (retain) NSString *notes;
@property (retain) File *root;

- (id) initWithFile:(File *)file andChildren:(BOOL) children;

- (id) initWithCoder:(NSCoder *)decoder;
- (void) encodeWithCoder:(NSCoder *)encoder;

- (id) initFileWithName:(NSString *)_name andSize:(unsigned long long)_size;
- (id) initDirectoryWithName:(NSString *)_name;

+ (File *) scanFromPath:(NSString *)path;

- (BOOL) isFile;
- (BOOL) isDirectory;
- (void) printWithIndentation:(int)ind;
- (NSString *)formattedSize;

- (NSArray *) getVisibleFiles:(NSArray *)unfiltered;
- (unsigned) countOfVisibleFiles;
- (File *) objectInVisibleFilesAtIndex:(unsigned)index;

- (unsigned) countOfFiles;
- (File *) objectInFilesAtIndex:(unsigned)index;
- (void) removeObjectFromFilesAtIndex:(int)index;
- (void) insertObject:(File *)file inFilesAtIndex:(int)index;

@end
